import  {cartsAPI} from '../../request/api'

export default({
  namespaced:true,
  state: {
	  cartsInfo:{
		  current:'',//当前页数
		  size:'',//每页个数
		  pages:'',//页数
		  count:'',//购物车数量
		  code:'',//0代表成功
		  message:'',//消息提示
		  timestamp:'',//时间戳
		  data:''//
	  }
  },
  getters: {
  },
  mutations: {
	  //更新用户信息
	  changecartsinfo(state,val){
		  state.cartsInfo=val;
		  console.log(state.cartsInfo.count);
	  },
  },
  actions: {
	  //发请求
	  async changeCart(context){
		const cartsRes=await cartsAPI();
		console.log(cartsRes);
		  context.commit('changecartsinfo',cartsRes)
	  }
  },
  modules: {
  }
})
